package com.bawei.mall.user.contorller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.product.domain.MallUserAddress;
import com.bawei.mall.user.domain.request.UserInformati;
import com.bawei.mall.user.domain.request.vo.UserVo;
import com.bawei.mall.user.service.UserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：张余庆
 * @Package：com.bawei.mall.user.contorller
 * @Project：mall_cloud
 * @name：UserContorller
 * @Date：2024/6/27 18:15
 */
@RestController
@RequestMapping("/user")
public class UserContorller {

    @Autowired
    private UserService service;

    /**
     * 功能：根据账号查询用户信息
     * @param username
     * @return
     */
    @GetMapping("getUser/{username}")
    public R<UserInformati> getUser(@PathVariable(value = "username") String username){
        UserInformati user = service.getUser(username);
        return R.ok(user);
    }


    /**
     * 功能：查询用户地址
     * @return
     */
    @GetMapping("userAddress")
    @ApiOperation(value = "查询用户地址")
    public R userAddress(){
        List<MallUserAddress> list = service.userAddress();
        return R.ok(list);
    }

}
